# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Sebastien LEDUC <sebastien@sleduc.fr>
# Contributor: Andrey Mikhaylenko <neithere at gmail dot com>

pkgname=python-pytest-cov
pkgver=4.1.0
pkgrel=1
pkgdesc='py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing'
arch=('any')
license=('MIT')
url='https://github.com/pytest-dev/pytest-cov'
depends=('python-coverage' 'python-pytest' 'python-tomli')
makedepends=('python-setuptools')
checkdepends=('python-virtualenv' 'python-process-tests' 'python-pytest-xdist' 'python-fields')
source=("$pkgname-$pkgver.tar.gz::https://github.com/pytest-dev/pytest-cov/archive/v$pkgver.tar.gz")
sha512sums=('d5eca8c750b6668a2b893e65d6799267d1a13eda78908880f454533a7846f1c4f94df6b5b702436e74a2ffb7912a19cae5edb6452abf3cc7c4765f187db039f1')

build() {
  cd pytest-cov-$pkgver
  python setup.py build
}

check() {
  # Hack entry points by installing it

  cd pytest-cov-$pkgver
  python setup.py install --root="$PWD/tmp_install" --optimize=1
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  PYTHONPATH="$PWD/tmp_install/$site_packages:$PYTHONPATH:$PWD/tests" pytest || echo "Tests failed"
}

package() {
  cd pytest-cov-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

# vim:set ts=2 sw=2 et:
